﻿using SW.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SW.BLL
{
    public static class DataAccessor
    {
        static string DALNameSpace;
        static DataAccessor()
        {
            DALNameSpace = Config.Connection.DALNamespace;
            if (String.IsNullOrEmpty(DALNameSpace))
                throw new System.Configuration.ConfigurationErrorsException();
        }

        public static object CreateInstance(string modelName)
        {
            object obj = Activator.CreateInstance(Type.GetType(DALNameSpace + "." + modelName));
            if (obj == null)
                throw new DllNotFoundException();
            return obj;
        }
    }
}
